<extend name="Base/common"/>
<block name="workclass">
    <div class="publish-more">
</block>
<block name="body">
        <div class="content">
            <div class="h2-title">您的项目需求描述</div>
            <div class="box form-more">
                <ul>
                    <li class="item-li">
                        <div class="item-input">
                            <input type="text" id="name" placeholder="项目名称" class="">
                            <div class="is-danger" style="display: none;"></div>
                        </div>
                    </li>
                    <li class="item-li">
                        <div class="item-input">
                            <input type="text" id="linkname" placeholder="项目联系人.如:张三" class="">
                            <div class="is-danger" style="display: none;"></div>
                        </div>
                    </li>
                    <li class="item-li">
                        <div class="item-input">
                            <input type="text" id="linknum" placeholder="联系方式" class="">
                            <div class="is-danger" style="display: none;"></div>
                        </div>
                    </li>
                    <li class="item-li">
                        <div class="item-select">
                            <select id="duration" class="js_type">
                                <option value>周期</option>
                                <option value="1">一周内</option>
                                <option value="2">一月内</option>
                                <option value="3">三月内</option>
                                <option value="4">半年内</option>
                            </select>
                            <div class="is-danger" style="display: none;"></div>
                        </div>
                    </li>
                    <li class="item-li">
                        <div class="item-input">
                            <input type="number" id="budget" placeholder="预算" class="">
                            <div class="wan">元</div>
                            <div class="is-danger" style="display: none;"></div>
                        </div>
                    </li>
                    <li class="item-li">
                        <div class="item-input">
                            <input type="text" id="address" placeholder="项目所在城市,例 郑州" class="">
                            <div class="is-danger" style="display: none;"></div>
                        </div>
                    </li>
                    <li class="item-li">
                        <div class="item-input">
                            <input type="number" id="dieday" placeholder="竞标有效期(默认7天)" class="">
                            <div class="wan">天</div>
                            <div class="is-danger" style="display: none;"></div>
                        </div>
                    </li>
                    <li class="item-li">
                        <div class="item-select">
                            <select class="js_type" id="type">
                                <option value>雇主类型</option>
                                <option value="1">个人</option>
                                <option value="2">设计院</option>
                                <option value="3">公司</option>
                            </select>
                            <div class="is-danger" style="display: none;"></div>
                        </div>
                    </li>
                    <li class="item-li">
                        <div class="item-name">项目需求描述</div>
                        <div class="item-input">
                            <textarea id="desc" placeholder="项目简介。例如：打算开发一个微信应用，市面上可参考的产品是 XXX，针对 XXX 领域和人群，主要目的是为了XX..." class=""></textarea>
                            <div class="is-danger" style="display: none;"></div>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="is-danger" style="display: none;"></div>
            <div class="btn-box">
                <div wbds-event-name="发布项目按钮" class="btn btn-fabu" id="publish">发布项目</div>
            </div>
        </div>
</block>
<block name="script">
    <script type="text/javascript">
        //'index-nav-show'
        (function() {
            // 菜单
            var headerMenu = $('.header-menu');
            $('.icon-nav-menu').click(function(){
                headerMenu.addClass('menuShow');
            });
            $('.icon-nav-close').click(function(){
                headerMenu.removeClass('menuShow');
            });

            var setHeader = function() {
                var st = $(window).scrollTop();
                if(st > 0) {
                    $('.header-pc').removeClass('header-transparent');
                } else {
                    $('.header-pc').addClass('header-transparent');
                }
            };
            setHeader();
            $(window).scroll(function() {
                setHeader();
            });

            //表单提交
            $('#publish').click(function () {
                var pro = {};
                pro.name        = $('#name').val();
                pro.linkname    = $('#linkname').val();
                pro.linknum     = $('#linknum').val();
                pro.desc        = $('#desc').val();
                pro.reference   = $('#reference').val();
                pro.budget      = $('#budget').val();
                pro.duration    = $('#duration').val();
                pro.dieday      = $('#dieday').val();
                pro.type        = $('#type').val();

                $.post("{:U('Worker/publish')}", pro, function (data) {
                    if( 1 == data.status ){
                        alert('发布成功');
                        window.location.href = "{:U('User/publist')}";
                    }else {
                        alert('发布失败');
                        return false;
                    }
                }, 'json');
            });
        })();
    </script>
</block>